import request from "@/utils/request.ts";

import { AxiosProgressEvent } from "axios";

type UploadProgress = {
  signal?: AbortSignal;
  onUploadProgress?: (event: AxiosProgressEvent) => void;
  onDownloadProgress?: (event: AxiosProgressEvent) => void;
};

export const upload = (params: FormData, progressFunc: UploadProgress) => {
  return request.post("/upload", params, {
    onUploadProgress: progressFunc.onUploadProgress,
    onDownloadProgress: progressFunc.onDownloadProgress,
  });
};
